home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / DirectShow_WinXP / VMR / VMRXcl / app.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-08  |  5.9 KB  |  343 lines

  1. //----------------------------------------------------------------------------
  2. //  File:   app.h
  3. //
  4. //  Desc:   DirectShow sample code
  5. //          Header file for customized video player application
  6. //
  7. //  Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
  8. //----------------------------------------------------------------------------
  9.  
  10. /* -------------------------------------------------------------------------
  11. ** Functions prototypes
  12. ** -------------------------------------------------------------------------
  13. */
  14. int
  15. DoMainLoop(
  16.     void
  17.     );
  18.  
  19. BOOL
  20. InitApplication(
  21.     HINSTANCE hInstance
  22.     );
  23.  
  24. BOOL
  25. InitInstance(
  26.     HINSTANCE hInstance,
  27.     int nCmdShow
  28.     );
  29.  
  30.  
  31. void
  32. UpdateMpegMovieRect(
  33.     void
  34.     );
  35.  
  36. void
  37. GetAdjustedClientRect(
  38.     RECT *prc
  39.     );
  40.  
  41. BOOL
  42. DrawStats(
  43.     HDC hdc
  44.     );
  45.  
  46. void
  47. CalcMovieRect(
  48.     LPRECT lprc
  49.     );
  50.  
  51. LPCTSTR
  52. IdStr(
  53.     int idResource
  54.     );
  55.  
  56. void
  57. UpdateSystemColors(
  58.     void
  59.     );
  60.  
  61.  
  62.  
  63. /* -------------------------------------------------------------------------
  64. ** Message crackers
  65. ** -------------------------------------------------------------------------
  66. */
  67. #define HANDLE_WM_USER(hwnd, wParam, lParam, fn) \
  68.     ((fn)(hwnd, wParam, lParam), 0L)
  69.  
  70. #ifndef HANDLE_WM_NOTIFY
  71. #define HANDLE_WM_NOTIFY(hwnd, wParam, lParam, fn) \
  72.     (fn)((hwnd), (int)(wParam), (NMHDR FAR*)(lParam))
  73. #endif
  74.  
  75.  
  76.  
  77. /* -------------------------------------------------------------------------
  78. ** VideoCd window class prototypes
  79. ** -------------------------------------------------------------------------
  80. */
  81. extern "C" LRESULT CALLBACK
  82. VideoCdWndProc(
  83.     HWND hwnd,
  84.     UINT message,
  85.     WPARAM wParam,
  86.     LPARAM lParam
  87.     );
  88.  
  89. void
  90. VideoCd_OnClose(
  91.     HWND hwnd
  92.     );
  93.  
  94. BOOL
  95. VideoCd_OnQueryEndSession(
  96.     HWND hwnd
  97.     );
  98.  
  99. void
  100. VideoCd_OnDestroy(
  101.     HWND hwnd
  102.     );
  103.  
  104. void
  105. VideoCd_OnClick(
  106.     HWND hwnd,
  107.     WPARAM pParam,
  108.     LPARAM lParam);
  109.  
  110. void
  111. VideoCd_OnClickHold(
  112.     HWND hwnd,
  113.     WPARAM pParam,
  114.     LPARAM lParam);
  115.  
  116. void
  117. VideoCd_OnCommand(
  118.     HWND hwnd,
  119.     int id,
  120.     HWND hwndCtl,
  121.     UINT codeNotify
  122.     );
  123.  
  124. void
  125. VideoCd_OnPaint(
  126.     HWND hwnd
  127.     );
  128.  
  129. void
  130. VideoCd_OnTimer(
  131.     HWND hwnd,
  132.     UINT id
  133.     );
  134.  
  135. BOOL
  136. VideoCd_OnCreate(
  137.     HWND hwnd,
  138.     LPCREATESTRUCT lpCreateStruct
  139.     );
  140.  
  141. void
  142. VideoCd_OnSize(
  143.     HWND hwnd,
  144.     UINT state,
  145.     int cx,
  146.     int cy
  147.     );
  148.  
  149. void
  150. VideoCd_OnKeyUp(
  151.     HWND hwnd,
  152.     UINT vk,
  153.     BOOL fDown,
  154.     int cRepeat,
  155.     UINT flags
  156.     );
  157.  
  158. void
  159. VideoCd_OnHScroll(
  160.     HWND hwnd,
  161.     HWND hwndCtl,
  162.     UINT code,
  163.     int pos
  164.     );
  165.  
  166. void
  167. VideoCd_OnUser(
  168.     HWND hwnd,
  169.     WPARAM wParam,
  170.     LPARAM lParam
  171.     );
  172.  
  173. void
  174. VideoCd_OnSysColorChange(
  175.     HWND hwnd
  176.     );
  177.  
  178. void
  179. VideoCd_OnMenuSelect(
  180.     HWND hwnd,
  181.     HMENU hmenu,
  182.     int item,
  183.     HMENU hmenuPopup,
  184.     UINT flags
  185.     );
  186.  
  187. void
  188. VideoCd_OnInitMenuPopup(
  189.     HWND hwnd,
  190.     HMENU hMenu,
  191.     UINT item,
  192.     BOOL fSystemMenu
  193.     );
  194.  
  195. #ifdef WM_NOTIFY
  196. LRESULT
  197. VideoCd_OnNotify(
  198.     HWND hwnd,
  199.     int idFrom,
  200.     NMHDR FAR* pnmhdr
  201.     );
  202. #endif
  203.  
  204.  
  205. void
  206. VideoCd_OnGraphNotify(
  207.     int stream
  208.     );
  209.  
  210. void
  211. VideoCd_OnDropFiles(
  212.     HWND hwnd,
  213.     HDROP hdrop);
  214.  
  215. void
  216. SetPlayButtonsEnableState(
  217.     void
  218.     );
  219.  
  220.  
  221.  
  222. /* -------------------------------------------------------------------------
  223. ** Command processing functions
  224. ** -------------------------------------------------------------------------
  225. */
  226.  
  227. BOOL
  228. VcdPlayerSetLog(
  229.     void
  230.     );
  231.  
  232. BOOL
  233. VcdPlayerSetPerfLogFile(
  234.     void
  235.     );
  236.  
  237. BOOL
  238. VcdPlayerOpenCmd(
  239.     void
  240.     );
  241.  
  242. BOOL
  243. VcdPlayerCloseCmd(
  244.     void
  245.     );
  246.  
  247. BOOL
  248. VcdPlayerPlayCmd(
  249.     void
  250.     );
  251.  
  252. BOOL
  253. VcdPlayerStopCmd(
  254.     void
  255.     );
  256.  
  257. BOOL
  258. VcdPlayerPauseCmd(
  259.     void
  260.     );
  261.  
  262. BOOL
  263. VcdPlayerPauseCmd(
  264.     void
  265.     );
  266.  
  267. void
  268. VcdPlayerSeekCmd(
  269.     REFTIME rtSeekBy
  270.     );
  271.  
  272. BOOL
  273. ProcessOpen(
  274.     TCHAR *achFileName,
  275.     BOOL bPlay = FALSE
  276.     );
  277.  
  278. /* -------------------------------------------------------------------------
  279. ** Recent filename stuff
  280. ** -------------------------------------------------------------------------
  281. */
  282. typedef TCHAR RECENTFILES[MAX_PATH];
  283. #define MAX_RECENT_FILES    5
  284. #define ID_RECENT_FILE_BASE 500
  285.  
  286. int
  287. GetRecentFiles(
  288.     int LastCount
  289.     );
  290.  
  291. int
  292. SetRecentFiles(
  293.     TCHAR *FileName,
  294.     int iCount
  295.     );
  296.  
  297.  
  298. /* -------------------------------------------------------------------------
  299. ** Global Variables
  300. ** -------------------------------------------------------------------------
  301. */
  302. extern int              cxMovie;
  303. extern int              cyMovie;
  304. extern HWND             hwndApp;
  305.  
  306. extern int              cx;
  307. extern int              cy;
  308. extern int              xOffset;
  309. extern int              yOffset;
  310. extern DWORD            g_State;
  311. extern TCHAR            g_szPerfLog[];
  312. extern int              g_TimeFormat;
  313.  
  314.  
  315. /* -------------------------------------------------------------------------
  316. ** Constants
  317. ** -------------------------------------------------------------------------
  318. */
  319. #define LEFT_MARGIN 0
  320.  
  321.  
  322. /* -------------------------------------------------------------------------
  323. ** Player states: these are bit flags
  324. ** -------------------------------------------------------------------------
  325. */
  326.  
  327. #define VCD_PLAYING          0x0001
  328. #define VCD_STOPPED          0x0002
  329. #define VCD_PAUSED           0x0004
  330. #define VCD_SKIP_F           0x0008
  331. #define VCD_SKIP_B           0x0010
  332. #define VCD_FF               0x0020
  333. #define VCD_RW               0x0040
  334. #define VCD_SEEKING          (VCD_FF | VCD_RW)
  335. #define VCD_LOADED           0x0080
  336. #define VCD_NO_CD            0x0100
  337. #define VCD_DATA_CD_LOADED   0x0200
  338. #define VCD_EDITING          0x0400
  339. #define VCD_PAUSED_AND_MOVED 0x0800
  340. #define VCD_PLAY_PENDING     0x1000
  341. #define VCD_WAS_PLAYING      0x2000
  342. #define VCD_IN_USE           0x4000
  343.